﻿using BookMange.Servies;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BookMange.Controllers
{
    [ApiController]
    [Route("test")]
    public class testController:ControllerBase
    {
        //构造函数注入
        private readonly IGetOneJoke _getJoke;

        public testController(IGetOneJoke getJoke)
        {
            this._getJoke = getJoke;
        }
        [HttpGet]
        [Route("joke")]
        public IActionResult Get()
        {
            var rel = _getJoke.GetOneJoke();
            return Ok(rel);
            //return NotFound();//如果没找到你要的东西（404）
        }
        [HttpGet("name")]
        //[Route("name")]
        public string GetName()
        {
            return "你的名字：";
        }
    }
}
